package wei.xinya.spring.proxy;

import wei.xinya.spring.service.MyService;

import java.util.Date;

/**
 * 静态代理
 */
public class ServiceProxy implements MyService {

    private MyService myService;

    public void setMyService(MyService myService) {
        this.myService = myService;
    }

    public ServiceProxy() {
    }

    public ServiceProxy(MyService myService) {
        this.myService = myService;
    }

    @Override
    public void doSome() {
        System.out.println("执行时间：" + new Date());
        myService.doSome();
        System.out.println("事务功能：提交事务处理");
    }

    @Override
    public String doOther() {
        System.out.println("执行时间：" + new Date());
        return myService.doOther();
    }
}
